package org.example.controller;

import org.example.util.Result;
import org.example.service.TypeService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/type")
public class TypeController {
    @Resource
    private TypeService typeService;
    @Transactional
    @GetMapping("/updateNum")
    public Boolean updateNum(@RequestParam("tid") Integer tid, @RequestParam("num") Integer num){
        return typeService.updateNum(tid, num);
    }
    @GetMapping("/selectId")
    public Result selectId(Integer tid){
      return Result.OK( typeService.getById(tid));
    }
}
